package com.bee.common.core.exception;

import com.bee.common.core.result.Result;
import com.bee.common.core.constant.Constant;

/**
 * Created by liekkas on 2017-8-1.
 * 全局应用类自定义异常
 * 为加强语义定义了BusinessException，DomainException（有需求可继续增加）
 */
public class ApplicationException extends RuntimeException {


    protected Result result;

    //异常级别，默认为低
    protected String exceptionLevel;

    public ApplicationException() {
    }


    public ApplicationException(Result result) {
        super();
        this.result = result;
        this.exceptionLevel = Constant.LOG_LEVEL_LOW;
    }

    public ApplicationException(Result result,String exceptionLevel) {
        super();
        this.result = result;
        this.exceptionLevel = exceptionLevel;
    }

    public ApplicationException(Result result, Throwable cause) {
        super(cause);
        this.result = result;
    }

    public ApplicationException(Throwable cause) {
        super(cause);
    }

    public ApplicationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public Result getResult() {
        return result;
    }

    public void setResult(Result result) {
        this.result = result;
    }

    public String getExceptionLevel() {
        return exceptionLevel;
    }

    public void setExceptionLevel(String exceptionLevel) {
        this.exceptionLevel = exceptionLevel;
    }
}
